import React, { FC, useContext } from 'react';
import { Button, Col } from 'antd';

import RenderField from '../../RenderField';
import { DesignRedux } from '../../DesignRedux';
import { getDashed } from '../../utils';

const AntdCol: FC = (props: any) => {
  const { schema } = props;
  const { globalState } = useContext(DesignRedux);
  const { rightNode } = globalState;

  // 获取样式
  let clazz = getDashed(rightNode, schema);

  return (
    <Col span={12} className={clazz}>
      {schema.children.map((item: any, index: any) => {
        return <RenderField nodeEle={item} key={index.toString()} />;
      })}
    </Col>
  );
};

export default AntdCol;
